package com.wanmait.myhouse.dao;

import com.wanmait.myhouse.util.DBHelper;
import com.wanmait.myhouse.vo.Manager;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class ManagerDAO {
    public Manager verLogin(Manager manager){
        QueryRunner queryRunner = new QueryRunner(DBHelper.getDruidDataSource());
        String sql = "select *,manager_name as managerName, manager_pass as managerPass  from t_manager where manager_name=? and manager_pass=? ";
        try {
            Manager man = queryRunner.query(sql, new BeanHandler<>(Manager.class),manager.getManagerName(),manager.getManagerPass());
            return man;
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }

}
